#if !defined(MCSORTLISTCTRL)
#define MCSORTLISTCTRL

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#ifndef OEMRESOURCE 
#error "#define OEMRESOURCE, because McSortListCtrl use OBM_UPARROWD and OBM_UPARROW bitmap resource"
#endif
// McSortListCtrl
enum LIST_DATA_TYPE
{ 
	INT_TYPE = 1,
	FLOAT_TYPE,
	STRING_TYPE,
	CONTAINTER_TYPE
};

struct MsColumnInfo
{
	LPCTSTR lpszTitle;
	int nFormat;
	int nWidth;
	LIST_DATA_TYPE dataType;
	MsColumnInfo(LPCTSTR p1 = _T(""), int p2 = 80, LIST_DATA_TYPE p3 = STRING_TYPE, int p4 = LVCFMT_LEFT);
};

class McSortListCtrl : public CListCtrl
{
	DECLARE_DYNAMIC(McSortListCtrl)

public:
	McSortListCtrl();
	virtual ~McSortListCtrl();

protected:
	DECLARE_MESSAGE_MAP()
private:
	friend int CALLBACK ListCompare(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
	bool m_bSortAsc;
	int m_nSortCol;
	void SetSortIcon();
	void CreateSortIcons();
	CBitmap m_bmpUpArrow;
	CBitmap m_bmpDownArrow;
	int m_nUpArrow;
	int m_nDownArrow;
	CImageList m_imglstSortIcons;
	afx_msg void OnLvnColumnclick(NMHDR *pNMHDR, LRESULT *pResult);

};

#endif //!defined(MCSORTLISTCTRL)
